---
layout: "default"
title: "Operator: +"
description: "Swift documentation for the '+' operator."
root: "/v3.0"
---

<code class="language-swift"> operator + {
    associativity left
    precedence 
}</code>

<h3>Declarations</h3>

<div class="declaration" id="func-pls_-double-rhs_-double">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-pls_-double-rhs_-double">func +(<wbr>_:<wbr> Double, rhs: Double)</a>
        
<div class="comment collapse" id="comment-func-pls_-double-rhs_-double"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func +(lhs: Double, rhs: Double) -&gt; Double</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-pls_-float-rhs_-float">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-pls_-float-rhs_-float">func +(<wbr>_:<wbr> Float, rhs: Float)</a>
        
<div class="comment collapse" id="comment-func-pls_-float-rhs_-float"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func +(lhs: Float, rhs: Float) -&gt; Float</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-pls_-float80-rhs_-float80">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-pls_-float80-rhs_-float80">func +(<wbr>_:<wbr> Float80, rhs: Float80)</a>
        
<div class="comment collapse" id="comment-func-pls_-float80-rhs_-float80"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func +(lhs: Float80, rhs: Float80) -&gt; Float80</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-pls_-int-rhs_-int">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-pls_-int-rhs_-int">func +(<wbr>_:<wbr> Int, rhs: Int)</a>
        
<div class="comment collapse" id="comment-func-pls_-int-rhs_-int"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func +(lhs: Int, rhs: Int) -&gt; Int</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-pls_-int8-rhs_-int8">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-pls_-int8-rhs_-int8">func +(<wbr>_:<wbr> Int8, rhs: Int8)</a>
        
<div class="comment collapse" id="comment-func-pls_-int8-rhs_-int8"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func +(lhs: Int8, rhs: Int8) -&gt; Int8</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-pls_-int16-rhs_-int16">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-pls_-int16-rhs_-int16">func +(<wbr>_:<wbr> Int16, rhs: Int16)</a>
        
<div class="comment collapse" id="comment-func-pls_-int16-rhs_-int16"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func +(lhs: Int16, rhs: Int16) -&gt; Int16</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-pls_-int32-rhs_-int32">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-pls_-int32-rhs_-int32">func +(<wbr>_:<wbr> Int32, rhs: Int32)</a>
        
<div class="comment collapse" id="comment-func-pls_-int32-rhs_-int32"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func +(lhs: Int32, rhs: Int32) -&gt; Int32</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-pls_-int64-rhs_-int64">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-pls_-int64-rhs_-int64">func +(<wbr>_:<wbr> Int64, rhs: Int64)</a>
        
<div class="comment collapse" id="comment-func-pls_-int64-rhs_-int64"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func +(lhs: Int64, rhs: Int64) -&gt; Int64</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-pls_-uint-rhs_-uint">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-pls_-uint-rhs_-uint">func +(<wbr>_:<wbr> UInt, rhs: UInt)</a>
        
<div class="comment collapse" id="comment-func-pls_-uint-rhs_-uint"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func +(lhs: UInt, rhs: UInt) -&gt; UInt</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-pls_-uint8-rhs_-uint8">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-pls_-uint8-rhs_-uint8">func +(<wbr>_:<wbr> UInt8, rhs: UInt8)</a>
        
<div class="comment collapse" id="comment-func-pls_-uint8-rhs_-uint8"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func +(lhs: UInt8, rhs: UInt8) -&gt; UInt8</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-pls_-uint16-rhs_-uint16">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-pls_-uint16-rhs_-uint16">func +(<wbr>_:<wbr> UInt16, rhs: UInt16)</a>
        
<div class="comment collapse" id="comment-func-pls_-uint16-rhs_-uint16"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func +(lhs: UInt16, rhs: UInt16) -&gt; UInt16</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-pls_-uint32-rhs_-uint32">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-pls_-uint32-rhs_-uint32">func +(<wbr>_:<wbr> UInt32, rhs: UInt32)</a>
        
<div class="comment collapse" id="comment-func-pls_-uint32-rhs_-uint32"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func +(lhs: UInt32, rhs: UInt32) -&gt; UInt32</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-pls_-uint64-rhs_-uint64">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-pls_-uint64-rhs_-uint64">func +(<wbr>_:<wbr> UInt64, rhs: UInt64)</a>
        
<div class="comment collapse" id="comment-func-pls_-uint64-rhs_-uint64"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func +(lhs: UInt64, rhs: UInt64) -&gt; UInt64</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-pls-c_-rangereplaceablecollection-s_-sequence-where-s-iterator-element-c-iterator-element_-c-rhs_-s">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-pls-c_-rangereplaceablecollection-s_-sequence-where-s-iterator-element-c-iterator-element_-c-rhs_-s">func <wbr>+ &lt;C :<wbr> RangeReplaceableCollection, S : Sequence where S.Iterator.Element == C.Iterator.Element&gt;(<wbr>_:<wbr> C, rhs: S)</a>
        
<div class="comment collapse" id="comment-func-pls-c_-rangereplaceablecollection-s_-sequence-where-s-iterator-element-c-iterator-element_-c-rhs_-s"><div class="p">
    <p>Creates a new collection by concatenating the elements of a collection and
a sequence.</p>

<p>The two arguments must have the same <code>Element</code> type. For example, you can
concatenate the elements of an integer array and a <code>Range&lt;Int&gt;</code> instance.</p>

<pre><code class="language-swift">let numbers = [1, 2, 3, 4]
let moreNumbers = numbers + 5...10
print(moreNumbers)
// Prints &quot;[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]&quot;</code></pre>

<p>The resulting collection has the type of the argument on the left-hand
side. In the example above, <code>moreNumbers</code> has the same type as <code>numbers</code>,
which is <code>[Int]</code>.</p>

<p><strong>Parameters:</strong>
  <strong>lhs:</strong> A range-replaceable collection.
  <strong>rhs:</strong> A collection or finite sequence.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func +&lt;C : RangeReplaceableCollection, S : Sequence where S.Iterator.Element == C.Iterator.Element&gt;(lhs: C, rhs: S) -&gt; C</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-pls-c_-rangereplaceablecollection-s_-sequence-where-s-iterator-element-c-iterator-element_-s-rhs_-c">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-pls-c_-rangereplaceablecollection-s_-sequence-where-s-iterator-element-c-iterator-element_-s-rhs_-c">func <wbr>+ &lt;C :<wbr> RangeReplaceableCollection, S : Sequence where S.Iterator.Element == C.Iterator.Element&gt;(<wbr>_:<wbr> S, rhs: C)</a>
        
<div class="comment collapse" id="comment-func-pls-c_-rangereplaceablecollection-s_-sequence-where-s-iterator-element-c-iterator-element_-s-rhs_-c"><div class="p">
    <p>Creates a new collection by concatenating the elements of a sequence and a
collection.</p>

<p>The two arguments must have the same <code>Element</code> type. For example, you can
concatenate the elements of a <code>Range&lt;Int&gt;</code> instance and an integer array.</p>

<pre><code class="language-swift">let numbers = [7, 8, 9, 10]
let moreNumbers = 1...6 + numbers
print(moreNumbers)
// Prints &quot;[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]&quot;</code></pre>

<p>The resulting collection has the type of argument on the right-hand side.
In the example above, <code>moreNumbers</code> has the same type as <code>numbers</code>, which
is <code>[Int]</code>.</p>

<p><strong>Parameters:</strong>
  <strong>lhs:</strong> A collection or finite sequence.
  <strong>rhs:</strong> A range-replaceable collection.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func +&lt;C : RangeReplaceableCollection, S : Sequence where S.Iterator.Element == C.Iterator.Element&gt;(lhs: S, rhs: C) -&gt; C</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-pls-pointee_-int-rhs_-unsafemutablepointer-pointee">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-pls-pointee_-int-rhs_-unsafemutablepointer-pointee">func + &lt;Pointee&gt;(<wbr>_:<wbr> Int, rhs: UnsafeMutablePointer&lt;Pointee&gt;)</a>
        
<div class="comment collapse" id="comment-func-pls-pointee_-int-rhs_-unsafemutablepointer-pointee"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func +&lt;Pointee&gt;(lhs: Int, rhs: UnsafeMutablePointer&lt;Pointee&gt;) -&gt; UnsafeMutablePointer&lt;Pointee&gt;</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-pls-pointee_-int-rhs_-unsafepointer-pointee">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-pls-pointee_-int-rhs_-unsafepointer-pointee">func + &lt;Pointee&gt;(<wbr>_:<wbr> Int, rhs: UnsafePointer&lt;Pointee&gt;)</a>
        
<div class="comment collapse" id="comment-func-pls-pointee_-int-rhs_-unsafepointer-pointee"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func +&lt;Pointee&gt;(lhs: Int, rhs: UnsafePointer&lt;Pointee&gt;) -&gt; UnsafePointer&lt;Pointee&gt;</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-pls-pointee_-unsafemutablepointer-pointee-rhs_-int">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-pls-pointee_-unsafemutablepointer-pointee-rhs_-int">func + &lt;Pointee&gt;(<wbr>_:<wbr> UnsafeMutablePointer&lt;Pointee&gt;, rhs: Int)</a>
        
<div class="comment collapse" id="comment-func-pls-pointee_-unsafemutablepointer-pointee-rhs_-int"><div class="p">
    <p><strong>Note:</strong> The following family of operator overloads are redundant
  with Strideable. However, optimizer improvements are needed
  before they can be removed without affecting performance.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func +&lt;Pointee&gt;(lhs: UnsafeMutablePointer&lt;Pointee&gt;, rhs: Int) -&gt; UnsafeMutablePointer&lt;Pointee&gt;</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-pls-pointee_-unsafepointer-pointee-rhs_-int">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-pls-pointee_-unsafepointer-pointee-rhs_-int">func + &lt;Pointee&gt;(<wbr>_:<wbr> UnsafePointer&lt;Pointee&gt;, rhs: Int)</a>
        
<div class="comment collapse" id="comment-func-pls-pointee_-unsafepointer-pointee-rhs_-int"><div class="p">
    <p><strong>Note:</strong> The following family of operator overloads are redundant
  with Strideable. However, optimizer improvements are needed
  before they can be removed without affecting performance.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func +&lt;Pointee&gt;(lhs: UnsafePointer&lt;Pointee&gt;, rhs: Int) -&gt; UnsafePointer&lt;Pointee&gt;</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-pls-rrc1_-rangereplaceablecollection-rrc2_-rangereplaceablecollection-where-rrc1-iterator-element-rrc2-iterator-element_-rrc1-rhs_-rrc2">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-pls-rrc1_-rangereplaceablecollection-rrc2_-rangereplaceablecollection-where-rrc1-iterator-element-rrc2-iterator-element_-rrc1-rhs_-rrc2">func <wbr>+ &lt;RRC1 :<wbr> RangeReplaceableCollection, RRC2 : RangeReplaceableCollection where RRC1.Iterator.Element == RRC2.Iterator.Element&gt;(<wbr>_:<wbr> RRC1, rhs: RRC2)</a>
        
<div class="comment collapse" id="comment-func-pls-rrc1_-rangereplaceablecollection-rrc2_-rangereplaceablecollection-where-rrc1-iterator-element-rrc2-iterator-element_-rrc1-rhs_-rrc2"><div class="p">
    <p>Creates a new collection by concatenating the elements of two collections.</p>

<p>The two arguments must have the same <code>Element</code> type. For example, you can
concatenate the elements of two integer arrays.</p>

<pre><code class="language-swift">let lowerNumbers = [1, 2, 3, 4]
let higherNumbers: ContiguousArray = [5, 6, 7, 8, 9, 10]
let allNumbers = lowerNumbers + higherNumbers
print(allNumbers)
// Prints &quot;[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]&quot;</code></pre>

<p>The resulting collection has the type of the argument on the left-hand
side. In the example above, <code>moreNumbers</code> has the same type as <code>numbers</code>,
which is <code>[Int]</code>.</p>

<p><strong>Parameters:</strong>
  <strong>lhs:</strong> A range-replaceable collection.
  <strong>rhs:</strong> Another range-replaceable collection.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func +&lt;RRC1 : RangeReplaceableCollection, RRC2 : RangeReplaceableCollection where RRC1.Iterator.Element == RRC2.Iterator.Element&gt;(lhs: RRC1, rhs: RRC2) -&gt; RRC1</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-pls-t_-integerarithmetic_-t-rhs_-t">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-pls-t_-integerarithmetic_-t-rhs_-t">func <wbr>+ &lt;T : _IntegerArithmetic&gt;(<wbr>_:<wbr> T, rhs: T)</a>
        
<div class="comment collapse" id="comment-func-pls-t_-integerarithmetic_-t-rhs_-t"><div class="p">
    <p>Adds <code>lhs</code> and <code>rhs</code>, returning the result and trapping in case of
arithmetic overflow (except in -Ounchecked builds).</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func +&lt;T : _IntegerArithmetic&gt;(lhs: T, rhs: T) -&gt; T</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-pls-t_-floatingpoint_-t-rhs_-t">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-pls-t_-floatingpoint_-t-rhs_-t">func <wbr>+ &lt;T : FloatingPoint&gt;(<wbr>_:<wbr> T, rhs: T)</a>
        
<div class="comment collapse" id="comment-func-pls-t_-floatingpoint_-t-rhs_-t"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func +&lt;T : FloatingPoint&gt;(lhs: T, rhs: T) -&gt; T</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-pls-t_-strideable_-t-rhs_-t-stride">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-pls-t_-strideable_-t-rhs_-t-stride">func <wbr>+ &lt;T : Strideable&gt;(<wbr>_:<wbr> T, rhs: T.Stride)</a>
        
<div class="comment collapse" id="comment-func-pls-t_-strideable_-t-rhs_-t-stride"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func +&lt;T : Strideable&gt;(lhs: T, rhs: T.Stride) -&gt; T</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-pls-t_-strideable_-t-stride-rhs_-t">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-pls-t_-strideable_-t-stride-rhs_-t">func <wbr>+ &lt;T : Strideable&gt;(<wbr>_:<wbr> T.Stride, rhs: T)</a>
        
<div class="comment collapse" id="comment-func-pls-t_-strideable_-t-stride-rhs_-t"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func +&lt;T : Strideable&gt;(lhs: T.Stride, rhs: T) -&gt; T</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-pls-t_-unsignedinteger_-t-rhs_-t-disallowmixedsignarithmetic">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-pls-t_-unsignedinteger_-t-rhs_-t-disallowmixedsignarithmetic">func <wbr>+ &lt;T : UnsignedInteger&gt;(<wbr>_:<wbr> T, rhs: T._DisallowMixedSignArithmetic)</a>
        
<div class="comment collapse" id="comment-func-pls-t_-unsignedinteger_-t-rhs_-t-disallowmixedsignarithmetic"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func +&lt;T : UnsignedInteger&gt;(lhs: T, rhs: T._DisallowMixedSignArithmetic) -&gt; T</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-pls-t_-unsignedinteger_-t-disallowmixedsignarithmetic-rhs_-t">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-pls-t_-unsignedinteger_-t-disallowmixedsignarithmetic-rhs_-t">func <wbr>+ &lt;T : UnsignedInteger&gt;(<wbr>_:<wbr> T._DisallowMixedSignArithmetic, rhs: T)</a>
        
<div class="comment collapse" id="comment-func-pls-t_-unsignedinteger_-t-disallowmixedsignarithmetic-rhs_-t"><div class="p">
    

    <h4>Declaration</h4>    
    <code class="language-swift">func +&lt;T : UnsignedInteger&gt;(lhs: T._DisallowMixedSignArithmetic, rhs: T) -&gt; T</code>
    
    
</div></div>
</div>
